home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_emacs.idb / usr / freeware / info / emacs-11.z / emacs-11
Encoding:
GNU Info File  |  1998-10-28  |  48.1 KB  |  1,144 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.63 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: TeX Mode,  Next: Nroff Mode,  Prev: Outline Mode,  Up: Text
  6.  
  7. TeX Mode
  8. ========
  9.  
  10.    TeX is a powerful text formatter written by Donald Knuth; it is also
  11. free, like GNU Emacs.  LaTeX is a simplified input format for TeX,
  12. implemented by TeX macros; it comes with TeX.  SliTeX is a special form
  13. of LaTeX.
  14.  
  15.    Emacs has a special TeX mode for editing TeX input files.  It
  16. provides facilities for checking the balance of delimiters and for
  17. invoking TeX on all or part of the file.
  18.  
  19.    TeX mode has three variants, Plain TeX mode, LaTeX mode, and SliTeX
  20. mode (these three distinct major modes differ only slightly).  They are
  21. designed for editing the three different formats.  The command `M-x
  22. tex-mode' looks at the contents of the buffer to determine whether the
  23. contents appear to be either LaTeX input or SliTeX input; if so, it
  24. selects the appropriate mode.  If the file contents do not appear to be
  25. LaTeX or SliTeX, it selects Plain TeX mode.  If the contents are
  26. insufficient to determine this, the variable `tex-default-mode'
  27. controls which mode is used.
  28.  
  29.    When `M-x tex-mode' does not guess right, you can use the commands
  30. `M-x plain-tex-mode', `M-x latex-mode', and `M-x slitex-mode' to select
  31. explicitly the particular variants of TeX mode.
  32.  
  33. * Menu:
  34.  
  35. * Editing: TeX Editing.   Special commands for editing in TeX mode.
  36. * LaTeX: LaTeX Editing.   Additional commands for LaTeX input files.
  37. * Printing: TeX Print.    Commands for printing part of a file with TeX.
  38. * Getting: TeX Distrib.   Getting the latest Unix TeX distribution.
  39.  
  40. 
  41. File: emacs,  Node: TeX Editing,  Next: LaTeX Editing,  Up: TeX Mode
  42.  
  43. TeX Editing Commands
  44. --------------------
  45.  
  46.    Here are the special commands provided in TeX mode for editing the
  47. text of the file.
  48.  
  49. `"'
  50.      Insert, according to context, either ```' or `"' or `'''
  51.      (`tex-insert-quote').
  52.  
  53. `LFD'
  54.      Insert a paragraph break (two newlines) and check the previous
  55.      paragraph for unbalanced braces or dollar signs
  56.      (`tex-terminate-paragraph').
  57.  
  58. `M-x validate-tex-region'
  59.      Check each paragraph in the region for unbalanced braces or dollar
  60.      signs.
  61.  
  62. `C-c {'
  63.      Insert `{}' and position point between them (`tex-insert-braces').
  64.  
  65. `C-c }'
  66.      Move forward past the next unmatched close brace (`up-list').
  67.  
  68.    In TeX, the character `"' is not normally used; we use ```' to start
  69. a quotation and `''' to end one.  To make editing easier under this
  70. formatting convention, TeX mode overrides the normal meaning of the key
  71. `"' with a command that inserts a pair of single-quotes or backquotes
  72. (`tex-insert-quote').  To be precise, this command inserts ```' after
  73. whitespace or an open brace, `"' after a backslash, and `''' after any
  74. other character.
  75.  
  76.    If you need the character `"' itself in unusual contexts, use `C-q'
  77. to insert it.  Also, `"' with a numeric argument always inserts that
  78. number of `"' characters.
  79.  
  80.    In TeX mode, `$' has a special syntax code which attempts to
  81. understand the way TeX math mode delimiters match.  When you insert a
  82. `$' that is meant to exit math mode, the position of the matching `$'
  83. that entered math mode is displayed for a second.  This is the same
  84. feature that displays the open brace that matches a close brace that is
  85. inserted.  However, there is no way to tell whether a `$' enters math
  86. mode or leaves it; so when you insert a `$' that enters math mode, the
  87. previous `$' position is shown as if it were a match, even though they
  88. are actually unrelated.
  89.  
  90.    TeX uses braces as delimiters that must match.  Some users prefer to
  91. keep braces balanced at all times, rather than inserting them singly.
  92. Use `C-c {' (`tex-insert-braces') to insert a pair of braces.  It
  93. leaves point between the two braces so you can insert the text that
  94. belongs inside.  Afterward, use the command `C-c }' (`up-list') to move
  95. forward past the close brace.
  96.  
  97.    There are two commands for checking the matching of braces.  LFD
  98. (`tex-terminate-paragraph') checks the paragraph before point, and
  99. inserts two newlines to start a new paragraph.  It prints a message in
  100. the echo area if any mismatch is found.  `M-x validate-tex-region'
  101. checks a region, paragraph by paragraph.  When it finds a paragraph that
  102. contains a mismatch, it displays point at the beginning of the paragraph
  103. for a few seconds and sets the mark at that spot.  Scanning continues
  104. until the whole buffer has been checked or until you type another key.
  105. Afterward, you can use the mark ring to find the last several paragraphs
  106. that had mismatches (*note Mark Ring::.).
  107.  
  108.    Note that Emacs commands count square brackets and parentheses in
  109. TeX mode, not just braces.  This is not strictly correct for the
  110. purpose of checking TeX syntax.  However, parentheses and square
  111. brackets are likely to be used in text as matching delimiters and it is
  112. useful for the various motion commands and automatic match display to
  113. work with them.
  114.  
  115. 
  116. File: emacs,  Node: LaTeX Editing,  Next: TeX Print,  Prev: TeX Editing,  Up: TeX Mode
  117.  
  118. LaTeX Editing Commands
  119. ----------------------
  120.  
  121.    LaTeX mode, and its variant, SliTeX mode, provide a few extra
  122. features not applicable to plain TeX.
  123.  
  124. `C-c C-o'
  125.      Insert `\begin' and `\end' for LaTeX block and position point on a
  126.      line between them. (`tex-latex-block').
  127.  
  128. `C-c C-e'
  129.      Close the last unended block for LaTeX (`tex-close-latex-block').
  130.  
  131.    In LaTeX input, `\begin' and `\end' commands are used to group
  132. blocks of text.  To insert a `\begin' and a matching `\end' (on a new
  133. line following the `\begin'), use `C-c C-o' (`tex-latex-block').  A
  134. blank line is inserted between the two, and point is left there.  You
  135. can use completion when you enter the block type; to specify additional
  136. block type names beyond the standard list, set the variable
  137. `latex-block-names'.  For example, here's how to add `theorem',
  138. `corollary', and `proof':
  139.  
  140.      (setq latex-block-names '("theorem" "corollary" "proof"))
  141.  
  142.    In LaTeX input, `\begin' and `\end' commands must balance.  You can
  143. use `C-c C-e' (`tex-close-latex-block') to insert automatically a
  144. matching `\end' to match the last unmatched `\begin'.  It indents the
  145. `\end' to match the corresponding `\begin'.  It inserts a newline after
  146. `\end' if point is at the beginning of a line.
  147.  
  148. 
  149. File: emacs,  Node: TeX Print,  Next: TeX Distrib,  Prev: LaTeX Editing,  Up: TeX Mode
  150.  
  151. TeX Printing Commands
  152. ---------------------
  153.  
  154.    You can invoke TeX as an inferior of Emacs on either the entire
  155. contents of the buffer or just a region at a time.  Running TeX in this
  156. way on just one chapter is a good way to see what your changes look
  157. like without taking the time to format the entire file.
  158.  
  159. `C-c C-r'
  160.      Invoke TeX on the current region, together with the buffer's header
  161.      (`tex-region').
  162.  
  163. `C-c C-b'
  164.      Invoke TeX on the entire current buffer (`tex-buffer').
  165.  
  166. `C-c TAB'
  167.      Invoke BibTeX on the current file (`tex-bibtex-file').
  168.  
  169. `C-c C-f'
  170.      Invoke TeX on the current file (`tex-file').
  171.  
  172. `C-c C-l'
  173.      Recenter the window showing output from the inferior TeX so that
  174.      the last line can be seen (`tex-recenter-output-buffer').
  175.  
  176. `C-c C-k'
  177.      Kill the TeX subprocess (`tex-kill-job').
  178.  
  179. `C-c C-p'
  180.      Print the output from the last `C-c C-r', `C-c C-b', or `C-c C-f'
  181.      command (`tex-print').
  182.  
  183. `C-c C-v'
  184.      Preview the output from the last `C-c C-r', `C-c C-b', or `C-c
  185.      C-f' command (`tex-view').
  186.  
  187. `C-c C-q'
  188.      Show the printer queue (`tex-show-print-queue').
  189.  
  190.    You can pass the current buffer through an inferior TeX by means of
  191. `C-c C-b' (`tex-buffer').  The formatted output appears in a temporary
  192. file; to print it, type `C-c C-p' (`tex-print').  Afterward, you can
  193. use `C-c C-q' (`tex-show-print-queue') to view the progress of your
  194. output towards being printed.  If your terminal has the ability to
  195. display TeX output files, you can preview the output on the terminal
  196. with `C-c C-v' (`tex-view').
  197.  
  198.    You can specify the directory to use for running TeX by setting the
  199. variable `tex-directory'.  `"."' is the default value.  If your
  200. environment variable `TEXINPUTS' contains relative directory names, or
  201. if your files contains `\input' commands with relative file names, then
  202. `tex-directory' *must* be `"."' or you will get the wrong results.
  203. Otherwise, it is safe to specify some other directory, such as `"/tmp"'.
  204.  
  205.    If you want to specify which shell commands are used in the inferior
  206. TeX, you can do so by setting the values of the variables
  207. `tex-run-command', `latex-run-command', `slitex-run-command',
  208. `tex-dvi-print-command', `tex-dvi-view-command', and
  209. `tex-show-queue-command'.  You *must* set the value of
  210. `tex-dvi-view-command' for your particular terminal; this variable has
  211. no default value.  The other variables have default values that may (or
  212. may not) be appropriate for your system.
  213.  
  214.    Normally, the file name given to these commands comes at the end of
  215. the command string; for example, `latex FILENAME'.  In some cases,
  216. however, the file name needs to be embedded in the command; an example
  217. is when you need to provide the file name as an argument to one command
  218. whose output is piped to another.  You can specify where to put the
  219. file name with `*' in the command string.  For example,
  220.  
  221.      (setq tex-dvi-print-command "dvips -f * | lpr")
  222.  
  223.    The terminal output from TeX, including any error messages, appears
  224. in a buffer called `*tex-shell*'.  If TeX gets an error, you can switch
  225. to this buffer and feed it input (this works as in Shell mode; *note
  226. Interactive Shell::.).  Without switching to this buffer you can scroll
  227. it so that its last line is visible by typing `C-c C-l'.
  228.  
  229.    Type `C-c C-k' (`tex-kill-job') to kill the TeX process if you see
  230. that its output is no longer useful.  Using `C-c C-b' or `C-c C-r' also
  231. kills any TeX process still running.
  232.  
  233.    You can also pass an arbitrary region through an inferior TeX by
  234. typing `C-c C-r' (`tex-region').  This is tricky, however, because most
  235. files of TeX input contain commands at the beginning to set parameters
  236. and define macros, without which no later part of the file will format
  237. correctly.  To solve this problem, `C-c C-r' allows you to designate a
  238. part of the file as containing essential commands; it is included before
  239. the specified region as part of the input to TeX.  The designated part
  240. of the file is called the "header".
  241.  
  242.    To indicate the bounds of the header in Plain TeX mode, you insert
  243. two special strings in the file.  Insert `%**start of header' before the
  244. header, and `%**end of header' after it.  Each string must appear
  245. entirely on one line, but there may be other text on the line before or
  246. after.  The lines containing the two strings are included in the header.
  247. If `%**start of header' does not appear within the first 100 lines of
  248. the buffer, `C-c C-r' assumes that there is no header.
  249.  
  250.    In LaTeX mode, the header begins with `\documentstyle' and ends with
  251. `\begin{document}'.  These are commands that LaTeX requires you to use
  252. in any case, so nothing special needs to be done to identify the header.
  253.  
  254.    The commands (`tex-buffer') and (`tex-region') do all of their work
  255. in a temporary directory, and do not have available any of the auxiliary
  256. files needed by TeX for cross-references; these commands are generally
  257. not suitable for running the final copy in which all of the
  258. cross-references need to be correct.  When you want the auxiliary
  259. files, use `C-c C-f' (`tex-file') which runs TeX on the current
  260. buffer's file, in that file's directory.  Before TeX runs, you will be
  261. asked about saving any modified buffers.  Generally, you need to use
  262. (`tex-file') twice to get cross-references correct.
  263.  
  264.    For LaTeX files, you can use BibTeX to process the auxiliary file
  265. for the current buffer's file.  BibTeX looks up bibliographic citations
  266. in a data base and prepares the cited references for the bibliography
  267. section.  The command `C-c TAB' (`tex-bibtex-file') runs the shell
  268. command (`tex-bibtex-command') to produce a `.bbl' file for the current
  269. buffer's file.  Generally, you need to do `C-c C-f' (`tex-file') once
  270. to generate the `.aux' file, then do `C-c TAB' (`tex-bibtex-file'), and
  271. then repeat `C-c C-f' (`tex-file') twice more to get the
  272. cross-references correct.
  273.  
  274.    Entering any kind of TeX mode runs the hooks `text-mode-hook' and
  275. `tex-mode-hook'.  Then it runs either `plain-tex-mode-hook' or
  276. `latex-mode-hook', whichever is appropriate.  For SliTeX files, it
  277. calls `slitex-mode-hook'.  Starting the TeX shell runs the hook
  278. `tex-shell-hook'.  *Note Hooks::.
  279.  
  280. 
  281. File: emacs,  Node: TeX Distrib,  Prev: TeX Print,  Up: TeX Mode
  282.  
  283. Unix TeX Distribution
  284. ---------------------
  285.  
  286.    TeX for Unix systems can be obtained from the University of
  287. Washington for a distribution fee.
  288.  
  289.    To order a full distribution, specify whether you prefer 1/4 inch
  290. QIC-24 or 4mm DAT tape (9-track reel-to-reel is no longer available)
  291. and send $210.00 for a (tar or cpio) cartridge, payable to the
  292. University of Washington to:
  293.  
  294.      Pierre MacKay
  295.      Department of Classics
  296.      Denny Hall, Mail Stop DH-10
  297.      University of Washington
  298.      Seattle, Washington 98195
  299.  
  300. Purchase orders are acceptable, but there is an extra charge of $10.00,
  301. to pay for processing charges.
  302.  
  303. For overseas orders please add $20.00 to the base cost for shipment via
  304. air parcel post, or $30.00 for shipment via courier.
  305.  
  306.    The normal distribution is a tar tape, blocked 20, 1600 bpi, on an
  307. industry standard 2400 foot half-inch reel.  The physical format for the
  308. 1/4 inch streamer cartridges is QIC-24.  System V tapes can be written
  309. in cpio format, blocked 5120 bytes, with ASCII headers.
  310.  
  311. 
  312. File: emacs,  Node: Nroff Mode,  Next: Formatted Text,  Prev: TeX Mode,  Up: Text
  313.  
  314. Nroff Mode
  315. ==========
  316.  
  317.    Nroff mode is a mode like Text mode but modified to handle nroff
  318. commands present in the text.  Invoke `M-x nroff-mode' to enter this
  319. mode.  It differs from Text mode in only a few ways.  All nroff command
  320. lines are considered paragraph separators, so that filling will never
  321. garble the nroff commands.  Pages are separated by `.bp' commands.
  322. Comments start with backslash-doublequote.  Also, three special
  323. commands are provided that are not in Text mode:
  324.  
  325. `M-n'
  326.      Move to the beginning of the next line that isn't an nroff command
  327.      (`forward-text-line').  An argument is a repeat count.
  328.  
  329. `M-p'
  330.      Like `M-n' but move up (`backward-text-line').
  331.  
  332. `M-?'
  333.      Prints in the echo area the number of text lines (lines that are
  334.      not nroff commands) in the region (`count-text-lines').
  335.  
  336.    The other feature of Nroff mode is that you can turn on Electric
  337. Nroff mode.  This is a minor mode that you can turn on or off with `M-x
  338. electric-nroff-mode' (*note Minor Modes::.).  When the mode is on, each
  339. time you use RET to end a line that contains an nroff command that
  340. opens a kind of grouping, the matching nroff command to close that
  341. grouping is automatically inserted on the following line.  For example,
  342. if you are at the beginning of a line and type `. ( b RET', this
  343. inserts the matching command `.)b' on a new line following point.
  344.  
  345.    If you use Outline minor mode with Nroff mode (*note Outline
  346. Mode::.), heading lines are lines of the form `.H' followed by a number
  347. (the header level).
  348.  
  349.    Entering Nroff mode runs the hook `text-mode-hook', followed by the
  350. hook `nroff-mode-hook' (*note Hooks::.).
  351.  
  352. 
  353. File: emacs,  Node: Formatted Text,  Prev: Nroff Mode,  Up: Text
  354.  
  355. Editing Formatted Text
  356. ======================
  357.  
  358.    "Enriched mode" is a minor mode for editing files that contain
  359. formatted text in WYSIWYG fashion, as in a word processor.  Currently,
  360. formatted text in Enriched mode can specify fonts, colors, underlining,
  361. margins, and types of filling and justification.  In the future, we plan
  362. to implement other formatting features as well.
  363.  
  364.    Enriched mode is a minor mode (*note Minor Modes::.).  Typically it
  365. is used in conjunction with Text mode (*note Text Mode::.).  However,
  366. you can also use it with other major modes such as Outline mode and
  367. Indented Text mode.
  368.  
  369.    Potentially, Emacs can store formatted text files in various file
  370. formats.  Currently, only one format is implemented: "text/enriched"
  371. format, which is defined by the MIME protocol.  *Note Format
  372. Conversion: (elisp)Format Conversion, for details of how Emacs
  373. recognizes and converts file formats.
  374.  
  375.    The Emacs distribution contains a formatted text file that can serve
  376. as an example.  Its name is `etc/enriched.doc'.  It contains samples
  377. illustrating all the features described in this section.  It also
  378. contains a list of ideas for future enhancements.
  379.  
  380. * Menu:
  381.  
  382. * Requesting Formatted Text::   Entering and exiting Enriched mode.
  383. * Hard and Soft Newlines::      There are two different kinds of newlines.
  384. * Editing Format Info::         How to edit text properties.
  385. * Faces: Format Faces.          Bold, italic, underline, etc.
  386. * Color: Format Colors.         Changing the color of text.
  387. * Indent: Format Indentation.   Changing the left and right margins.
  388. * Justification: Format Justification.
  389.                                 Centering, setting text flush with the
  390.                                   left or right margin, etc.
  391. * Other: Format Properties.     The "special" text properties submenu.
  392. * Forcing Enriched Mode::       How to force use of Enriched mode.
  393.  
  394. 
  395. File: emacs,  Node: Requesting Formatted Text,  Next: Hard and Soft Newlines,  Up: Formatted Text
  396.  
  397. Requesting to Edit Formatted Text
  398. ---------------------------------
  399.  
  400.    Whenever you visit a file that Emacs saved in the text/enriched
  401. format, Emacs automatically converts the formatting information in the
  402. file into Emacs's own internal format (text properties), and turns on
  403. Enriched mode.
  404.  
  405.    To create a new file of formatted text, first visit the nonexistent
  406. file, then type `M-x enriched-mode' before you start inserting text.
  407. This command turns on Enriched mode.  Do this before you begin inserting
  408. text, to ensure that the text you insert is handled properly.
  409.  
  410.    More generally, the command `enriched-mode' turns Enriched mode on
  411. if it was off, and off if it was on.  With a prefix argument, this
  412. command turns Enriched mode on if the argument is positive, and turns
  413. the mode off otherwise.
  414.  
  415.    When you save a buffer while Enriched mode is enabled in it, Emacs
  416. automatically converts the text to text/enriched format while writing it
  417. into the file.  When you visit the file again, Emacs will automatically
  418. recognize the format, reconvert the text, and turn on Enriched mode
  419. again.
  420.  
  421.    Normally, after reading a file in text/enriched format, Emacs refills
  422. each paragraph to fit the width of the window.  You can turn off this
  423. refilling, to save time, by setting the variable
  424. `enriched-fill-after-visiting' to `nil' or to `ask'.
  425.  
  426.    In any case, if the window width is the same as the width with which
  427. the file was saved, Emacs trusts that the file is already properly
  428. filled.
  429.  
  430.    You can add annotations for saving additional text properties, which
  431. Emacs normally does not save, by adding to `enriched-translations'.
  432. Note that the text/enriched standard requires any non-standard
  433. annotations to have names starting with `x-', as in `x-read-only'.
  434. This ensures that they will not conflict with standard annotations that
  435. may be added later.
  436.  
  437. 
  438. File: emacs,  Node: Hard and Soft Newlines,  Next: Editing Format Info,  Prev: Requesting Formatted Text,  Up: Formatted Text
  439.  
  440. Hard and Soft Newlines
  441. ----------------------
  442.  
  443.    In formatted text, Emacs distinguishes between two different kinds of
  444. newlines, "hard" newlines and "soft" newlines.
  445.  
  446.    Hard newlines are used to separate paragraphs, or items in a list, or
  447. anywhere that there should always be a line break regardless of the
  448. margins.  The `RET' command (`newline') and `C-o' (`open-line') insert
  449. hard newlines.
  450.  
  451.    Soft newlines are used to make text fit between the margins.  All the
  452. fill commands, including Auto Fill, insert soft newlines--and they
  453. delete only soft newlines.
  454.  
  455.    Although hard and soft newlines look the same, it is important to
  456. bear the difference in mind.  Do not use RET to break lines in the
  457. middle of filled paragraphs, or else you will get hard newlines that are
  458. barriers to further filling.  Instead, let Auto Fill mode break lines,
  459. so that if the text or the margins change, Emacs can refill the lines
  460. properly.  *Note Auto Fill::.
  461.  
  462.    On the other hand, in tables and lists, where the lines should always
  463. remain as you type them, you can use RET to end lines.  For these
  464. lines, you may also want to set the justification style to `unfilled'.
  465. *Note Format Justification::.
  466.  
  467. 
  468. File: emacs,  Node: Editing Format Info,  Next: Format Faces,  Prev: Hard and Soft Newlines,  Up: Formatted Text
  469.  
  470. Editing Format Information
  471. --------------------------
  472.  
  473.    There are two ways to alter the formatting information for a
  474. formatted text file: with keyboard commands, and with the mouse.
  475.  
  476.    The easiest way to add properties to your document is by using the
  477. Text Properties menu.  You can get to this menu in two ways: from the
  478. Edit menu in the menu bar, or with `C-mouse-2' (hold the CTRL key and
  479. press the middle mouse button).
  480.  
  481.    Most of the items in the Text Properties menu lead to other submenus.
  482. These are described in the sections that follow.  Some items run
  483. commands directly:
  484.  
  485. `Remove Properties'
  486.      Delete from the region all the text properties that the Text
  487.      Properties menu works with (`facemenu-remove-props').
  488.  
  489. `Remove All'
  490.      Delete *all* text properties from the region
  491.      (`facemenu-remove-all').
  492.  
  493. `List Properties'
  494.      List all the text properties of the character following point
  495.      (`list-text-properties-at').
  496.  
  497. `Display Faces'
  498.      Display a list of all the defined faces.
  499.  
  500. `Display Colors'
  501.      Display a list of all the defined colors.
  502.  
  503. 
  504. File: emacs,  Node: Format Faces,  Next: Format Colors,  Prev: Editing Format Info,  Up: Formatted Text
  505.  
  506. Faces in Formatted Text
  507. -----------------------
  508.  
  509.    The Faces submenu lists various Emacs faces including `bold',
  510. `italic', and `underline'.  Selecting one of these adds the chosen face
  511. to the region.  *Note Faces::.  You can also specify a face with these
  512. keyboard commands:
  513.  
  514. `M-g d'
  515.      Set the region, or the next inserted character, to the `default'
  516.      face (`facemenu-set-default').
  517.  
  518. `M-g b'
  519.      Set the region, or the next inserted character, to the `bold' face
  520.      (`facemenu-set-bold').
  521.  
  522. `M-g i'
  523.      Set the region, or the next inserted character, to the `italic'
  524.      face (`facemenu-set-italic').
  525.  
  526. `M-g l'
  527.      Set the region, or the next inserted character, to the
  528.      `bold-italic' face (`facemenu-set-bold-italic').
  529.  
  530. `M-g u'
  531.      Set the region, or the next inserted character, to the `underline'
  532.      face (`facemenu-set-underline').
  533.  
  534. `M-g o FACE RET'
  535.      Set the region, or the next inserted character, to the face FACE
  536.      (`facemenu-set-face').
  537.  
  538.    If you use these commands with a prefix argument--or, in Transient
  539. Mark mode, if the region is not active--then these commands specify a
  540. face to use for your next self-inserting input.  *Note Transient
  541. Mark::.  This applies to both the keyboard commands and the menu
  542. commands.
  543.  
  544.    Enriched mode defines two additional faces: `excerpt' and `fixed'.
  545. These correspond to codes used in the text/enriched file format.
  546.  
  547.    The `excerpt' face is intended for quotations.  This face is the
  548. same as `italic' unless you customize it (*note Modifying Faces::.).
  549.  
  550.    The `fixed' face is meant to say, "Use a fixed-width font for this
  551. part of the text."  Emacs currently supports only fixed-width fonts;
  552. therefore, the `fixed' annotation is not necessary now.  However, we
  553. plan to support variable width fonts in future Emacs versions, and
  554. other systems that display text/enriched format may not use a
  555. fixed-width font as the default.  So if you specifically want a certain
  556. part of the text to use a fixed-width font, you should specify the
  557. `fixed' face for that part.
  558.  
  559.    The `fixed' face is normally defined to use a different font from
  560. the default.  However, systems have different fonts installed, you may
  561. need to customize this.
  562.  
  563.    If your terminal cannot display different faces, you will not be able
  564. to see them, but you can still edit documents containing faces.  You can
  565. even add faces and colors to documents.  They will be visible when the
  566. file is viewed on a terminal that can display them.
  567.  
  568. 
  569. File: emacs,  Node: Format Colors,  Next: Format Indentation,  Prev: Format Faces,  Up: Formatted Text
  570.  
  571. Colors in Formatted Text
  572. ------------------------
  573.  
  574.    You can specify foreground and background colors for portions of the
  575. text.  There is a menu for specifying the foreground color and a menu
  576. for specifying the background color.  Each color menu lists all the
  577. colors that you have used in Enriched mode in the current Emacs session.
  578.  
  579.    If you specify a color with a prefix argument--or, in Transient Mark
  580. mode, if the region is not active--then it applies to your next
  581. self-inserting input.  *Note Transient Mark::.  Otherwise, the command
  582. applies to the region.
  583.  
  584.    Each color menu contains one additional item: `Other'.  You can use
  585. this item to specify a color that is not listed in the menu; it reads
  586. the color name with the minibuffer.  To display list of available colors
  587. and their names, use the `Display Colors' menu item in the Text
  588. Properties menu (*note Editing Format Info::.).
  589.  
  590.    Any color that you specify in this way, or that is mentioned in a
  591. formatted text file that you read in, is added to both color menus for
  592. the duration of the Emacs session.
  593.  
  594.    There are no key bindings for specifying colors, but you can do so
  595. with the extended commands `M-x facemenu-set-foreground' and `M-x
  596. facemenu-set-background'.  Both of these commands read the name of the
  597. color with the minibuffer.
  598.  
  599. 
  600. File: emacs,  Node: Format Indentation,  Next: Format Justification,  Prev: Format Colors,  Up: Formatted Text
  601.  
  602. Indentation in Formatted Text
  603. -----------------------------
  604.  
  605.    When editing formatted text, you can specify different amounts of
  606. indentation for the right or left margin of an entire paragraph or a
  607. part of a paragraph.  The margins you specify automatically affect the
  608. Emacs fill commands (*note Filling::.) and line-breaking commands.
  609.  
  610.    The Indentation submenu provides a convenient interface for
  611. specifying these properties.  The submenu contains four items:
  612.  
  613. `Indent More'
  614.      Indent the region by 4 columns (`increase-left-margin').  In
  615.      Enriched mode, this command is also available on `C-x TAB'; if you
  616.      supply a numeric argument, that says how many columns to add to the
  617.      margin (a negative argument reduces the number of columns).
  618.  
  619. `Indent Less'
  620.      Remove 4 columns of indentation from the region.
  621.  
  622. `Indent Right More'
  623.      Make the text narrower by indenting 4 columns at the right margin.
  624.  
  625. `Indent Right Less'
  626.      Remove 4 columns of indentation from the right margin.
  627.  
  628.    You can use these commands repeatedly to increase or decrease the
  629. indentation.
  630.  
  631.    The most common way to use these commands is to change the
  632. indentation of an entire paragraph.  However, that is not the only use.
  633. You can change the margins at any point; the new values take effect at
  634. the end of the line (for right margins) or the beginning of the next
  635. line (for left margins).
  636.  
  637.    This makes it possible to format paragraphs with "hanging indents",
  638. which means that the first line is indented less than subsequent lines.
  639. To set up a hanging indent, increase the indentation of the region
  640. starting after the first word of the paragraph and running until the end
  641. of the paragraph.
  642.  
  643.    Indenting the first line of a paragraph is easier.  Set the margin
  644. for the whole paragraph where you want it to be for the body of the
  645. paragraph, then indent the first line by inserting extra spaces or tabs.
  646.  
  647.    Sometimes, as a result of editing, the filling of a paragraph becomes
  648. messed up--parts of the paragraph may extend past the left or right
  649. margins.  When this happens, use `M-q' (`fill-paragraph') to refill the
  650. paragraph.
  651.  
  652.    The variable `standard-indent' specifies how many columns these
  653. commands should add to or subtract from the indentation.  The default
  654. value is 4.
  655.  
  656.    Enriched mode automatically sets the variable `fill-column' based on
  657. the window width: it leaves a certain number of columns for the right
  658. margin.  The variable `enriched-default-right-margin' says how many
  659. columns.  The default value is 10.
  660.  
  661. 
  662. File: emacs,  Node: Format Justification,  Next: Format Properties,  Prev: Format Indentation,  Up: Formatted Text
  663.  
  664. Justification in Formatted Text
  665. -------------------------------
  666.  
  667.    When editing formatted text, you can specify various styles of
  668. justification for a paragraph.  The style you specify automatically
  669. affects the Emacs fill commands.
  670.  
  671.    The Justification submenu provides a convenient interface for
  672. specifying the style.  The submenu contains five items:
  673.  
  674. `Flush Left'
  675.      This is the most common style of justification (at least for
  676.      English).  Lines are aligned at the left margin but left uneven at
  677.      the right.
  678.  
  679. `Flush Right'
  680.      This aligns each line with the right margin.  Spaces and tabs are
  681.      added on the left, if necessary, to make lines line up on the
  682.      right.
  683.  
  684. `Full'
  685.      This justifies the text, aligning both edges of each line.
  686.      Justified text looks very nice in a printed book, where the spaces
  687.      can all be adjusted equally, but it does not look as nice with a
  688.      fixed-width font on the screen.  Perhaps a future version of Emacs
  689.      will be able to adjust the width of spaces in a line to achieve
  690.      elegant justification.
  691.  
  692. `Center'
  693.      This centers every line between the current margins.
  694.  
  695. `None'
  696.      This turns off filling entirely.  Each line will remain as you
  697.      wrote it; the fill and auto-fill functions will have no effect on
  698.      text which has this setting.  You can, however, still indent the
  699.      left margin.  In unfilled regions, all newlines are treated as
  700.      hard newlines (*note Hard and Soft Newlines::.) .
  701.  
  702.    In Enriched mode, you can also specify justification from the
  703. keyboard using the `M-j' prefix character:
  704.  
  705. `M-j l'
  706.      Make the region left-filled (`set-justification-left').
  707.  
  708. `M-j r'
  709.      Make the region right-filled (`set-justification-right').
  710.  
  711. `M-j f'
  712.      Make the region fully-justified (`set-justification-full').
  713.  
  714. `M-j c'
  715. `M-S'
  716.      Make the region centered (`set-justification-center').
  717.  
  718. `M-j u'
  719.      Make the region unfilled (`set-justification-none').
  720.  
  721.    Justification styles apply to entire paragraphs.  All the
  722. justification-changing commands operate on the paragraph containing
  723. point, or, if the region is active, on all paragraphs which overlap the
  724. region.
  725.  
  726.    The default justification style is specified by the variable
  727. `default-justification'.  Its value should be one of the symbols
  728. `left', `right', `full', `center', or `none'.
  729.  
  730. 
  731. File: emacs,  Node: Format Properties,  Next: Forcing Enriched Mode,  Prev: Format Justification,  Up: Formatted Text
  732.  
  733. Setting Other Text Properties
  734. -----------------------------
  735.  
  736.    The Other Properties menu lets you add or remove three other useful
  737. text properties: `read-only', `invisible' and `intangible'.  The
  738. `intangible' property disallows moving point within the text, the
  739. `invisible' text property hides text from display, and the `read-only'
  740. property disallows alteration of the text.
  741.  
  742.    Each of these special properties has a menu item to add it to the
  743. region.  The last menu item, `Remove Special', removes all of these
  744. special properties from the text in the region.
  745.  
  746.    Currently, the `invisible' and `intangible' properties are *not*
  747. saved in the text/enriched format.  The `read-only' property is saved,
  748. but it is not a standard part of the text/enriched format, so other
  749. editors may not respect it.
  750.  
  751. 
  752. File: emacs,  Node: Forcing Enriched Mode,  Prev: Format Properties,  Up: Formatted Text
  753.  
  754. Forcing Enriched Mode
  755. ---------------------
  756.  
  757.    Normally, Emacs knows when you are editing formatted text because it
  758. recognizes the special annotations used in the file that you visited.
  759. However, there are situations in which you must take special actions to
  760. convert file contents or turn on Enriched mode:
  761.  
  762.    * When you visit a file that was created with some other editor,
  763.      Emacs may not recognize the file as being in the text/enriched
  764.      format.  In this case, when you visit the file you will see the
  765.      formatting commands rather than the formatted text.  Type `M-x
  766.      format-decode-buffer' to translate it.
  767.  
  768.    * When you *insert* a file into a buffer, rather than visiting it.
  769.      Emacs does the necessary conversions on the text which you insert,
  770.      but it does not enable Enriched mode.  If you wish to do that,
  771.      type `M-x enriched-mode'.
  772.  
  773.    The command `format-decode-buffer' translates text in various
  774. formats into Emacs's internal format.  It asks you to specify the format
  775. to translate from; however, normally you can type just RET, which tells
  776. Emacs to guess the format.
  777.  
  778.    If you wish to look at a file in text/enriched format in its raw
  779. form, as a sequence of characters with no formatting, use `M-x
  780. format-find-file RET FILENAME RET RET'.  The empty second argument
  781. means, "read without format conversion."
  782.  
  783. 
  784. File: emacs,  Node: Programs,  Next: Building,  Prev: Text,  Up: Top
  785.  
  786. Editing Programs
  787. ****************
  788.  
  789.    Emacs has many commands designed to understand the syntax of
  790. programming languages such as Lisp and C.  These commands can
  791.  
  792.    * Move over or kill balanced expressions or "sexps" (*note Lists::.).
  793.  
  794.    * Move over or mark top-level expressions--"defuns", in Lisp;
  795.      functions, in C (*note Defuns::.).
  796.  
  797.    * Show how parentheses balance (*note Matching::.).
  798.  
  799.    * Insert, kill or align comments (*note Comments::.).
  800.  
  801.    * Follow the usual indentation conventions of the language (*note
  802.      Program Indent::.).
  803.  
  804.    The commands for words, sentences and paragraphs are very useful in
  805. editing code even though their canonical application is for editing
  806. human language text.  Most symbols contain words (*note Words::.);
  807. sentences can be found in strings and comments (*note Sentences::.).
  808. Paragraphs per se don't exist in code, but the paragraph commands are
  809. useful anyway, because programming language major modes define
  810. paragraphs to begin and end at blank lines (*note Paragraphs::.).
  811. Judicious use of blank lines to make the program clearer will also
  812. provide useful chunks of text for the paragraph commands to work on.
  813.  
  814.    The selective display feature is useful for looking at the overall
  815. structure of a function (*note Selective Display::.).  This feature
  816. causes only the lines that are indented less than a specified amount to
  817. appear on the screen.
  818.  
  819. * Menu:
  820.  
  821. * Program Modes::     Major modes for editing programs.
  822. * Lists::             Expressions with balanced parentheses.
  823. * List Commands::     The commands for working with list and sexps.
  824. * Defuns::            Each program is made up of separate functions.
  825.                         There are editing commands to operate on them.
  826. * Program Indent::    Adjusting indentation to show the nesting.
  827. * Matching::          Insertion of a close-delimiter flashes matching open.
  828. * Comments::          Inserting, killing, and aligning comments.
  829. * Balanced Editing::  Inserting two matching parentheses at once, etc.
  830. * Symbol Completion:: Completion on symbol names of your program or language.
  831. * Documentation::     Getting documentation of functions you plan to call.
  832. * Change Log::        Maintaining a change history for your program.
  833. * Tags::              Go direct to any function in your program in one
  834.                         command.  Tags remembers which file it is in.
  835. * Emerge::          A convenient way of merging two versions of a program.
  836. * C Mode::          Special commands of C, C++, Objective-C and Java modes.
  837. * Fortran::          Fortran mode and its special features.
  838. * Asm Mode::          Asm mode and its special features.
  839.  
  840. 
  841. File: emacs,  Node: Program Modes,  Next: Lists,  Up: Programs
  842.  
  843. Major Modes for Programming Languages
  844. =====================================
  845.  
  846.    Emacs also has major modes for the programming languages Lisp, Scheme
  847. (a variant of Lisp), Awk, C, C++, Fortran, Icon, Java, Objective-C,
  848. Pascal, Perl and Tcl.  There is also a major mode for makefiles, called
  849. Makefile mode.
  850.  
  851.    Ideally, a major mode should be implemented for each programming
  852. language that you might want to edit with Emacs; but often the mode for
  853. one language can serve for other syntactically similar languages.  The
  854. language modes that exist are those that someone decided to take the
  855. trouble to write.
  856.  
  857.    There are several forms of Lisp mode, which differ in the way they
  858. interface to Lisp execution.  *Note Executing Lisp::.
  859.  
  860.    Each of the programming language modes defines the TAB key to run an
  861. indentation function that knows the indentation conventions of that
  862. language and updates the current line's indentation accordingly.  For
  863. example, in C mode TAB is bound to `c-indent-line'.  LFD is normally
  864. defined to do RET followed by TAB; thus, it too indents in a
  865. mode-specific fashion.
  866.  
  867.    In most programming languages, indentation is likely to vary from
  868. line to line.  So the major modes for those languages rebind DEL to
  869. treat a tab as if it were the equivalent number of spaces (using the
  870. command `backward-delete-char-untabify').  This makes it possible to
  871. rub out indentation one column at a time without worrying whether it is
  872. made up of spaces or tabs.  Use `C-b C-d' to delete a tab character
  873. before point, in these modes.
  874.  
  875.    Programming language modes define paragraphs to be separated only by
  876. blank lines, so that the paragraph commands remain useful.  Auto Fill
  877. mode, if enabled in a programming language major mode, indents the new
  878. lines which it creates.
  879.  
  880.    Turning on a major mode runs a normal hook called the "mode hook",
  881. which is the value of a Lisp variable.  Each major mode has a mode hook,
  882. and the hook's name is always made from the mode command's name by
  883. adding `-hook'.  For example, turning on C mode runs the hook
  884. `c-mode-hook', while turning on Lisp mode runs the hook
  885. `lisp-mode-hook'.  *Note Hooks::.
  886.  
  887. 
  888. File: emacs,  Node: Lists,  Next: List Commands,  Prev: Program Modes,  Up: Programs
  889.  
  890. Lists and Sexps
  891. ===============
  892.  
  893.    By convention, Emacs keys for dealing with balanced expressions are
  894. usually Control-Meta characters.  They tend to be analogous in function
  895. to their Control and Meta equivalents.  These commands are usually
  896. thought of as pertaining to expressions in programming languages, but
  897. can be useful with any language in which some sort of parentheses exist
  898. (including human languages).
  899.  
  900.    These commands fall into two classes.  Some deal only with "lists"
  901. (parenthetical groupings).  They see nothing except parentheses,
  902. brackets, braces (whichever ones must balance in the language you are
  903. working with), and escape characters that might be used to quote those.
  904.  
  905.    The other commands deal with expressions or "sexps".  The word `sexp'
  906. is derived from "s-expression", the ancient term for an expression in
  907. Lisp.  But in Emacs, the notion of `sexp' is not limited to Lisp.  It
  908. refers to an expression in whatever language your program is written in.
  909. Each programming language has its own major mode, which customizes the
  910. syntax tables so that expressions in that language count as sexps.
  911.  
  912.    Sexps typically include symbols, numbers, and string constants, as
  913. well as anything contained in parentheses, brackets or braces.
  914.  
  915.    In languages that use prefix and infix operators, such as C, it is
  916. not possible for all expressions to be sexps.  For example, C mode does
  917. not recognize `foo + bar' as a sexp, even though it *is* a C expression;
  918. it recognizes `foo' as one sexp and `bar' as another, with the `+' as
  919. punctuation between them.  This is a fundamental ambiguity: both `foo +
  920. bar' and `foo' are legitimate choices for the sexp to move over if
  921. point is at the `f'.  Note that `(foo + bar)' is a single sexp in C
  922. mode.
  923.  
  924.    Some languages have obscure forms of expression syntax that nobody
  925. has bothered to make Emacs understand properly.
  926.  
  927. 
  928. File: emacs,  Node: List Commands,  Next: Defuns,  Prev: Lists,  Up: Programs
  929.  
  930. List And Sexp Commands
  931. ======================
  932.  
  933. `C-M-f'
  934.      Move forward over a sexp (`forward-sexp').
  935.  
  936. `C-M-b'
  937.      Move backward over a sexp (`backward-sexp').
  938.  
  939. `C-M-k'
  940.      Kill sexp forward (`kill-sexp').
  941.  
  942. `C-M-DEL'
  943.      Kill sexp backward (`backward-kill-sexp').
  944.  
  945. `C-M-u'
  946.      Move up and backward in list structure (`backward-up-list').
  947.  
  948. `C-M-d'
  949.      Move down and forward in list structure (`down-list').
  950.  
  951. `C-M-n'
  952.      Move forward over a list (`forward-list').
  953.  
  954. `C-M-p'
  955.      Move backward over a list (`backward-list').
  956.  
  957. `C-M-t'
  958.      Transpose expressions (`transpose-sexps').
  959.  
  960. `C-M-@'
  961.      Put mark after following expression (`mark-sexp').
  962.  
  963.    To move forward over a sexp, use `C-M-f' (`forward-sexp').  If the
  964. first significant character after point is an opening delimiter (`(' in
  965. Lisp; `(', `[' or `{' in C), `C-M-f' moves past the matching closing
  966. delimiter.  If the character begins a symbol, string, or number,
  967. `C-M-f' moves over that.
  968.  
  969.    The command `C-M-b' (`backward-sexp') moves backward over a sexp.
  970. The detailed rules are like those above for `C-M-f', but with
  971. directions reversed.  If there are any prefix characters (single-quote,
  972. backquote and comma, in Lisp) preceding the sexp, `C-M-b' moves back
  973. over them as well.  The sexp commands move across comments as if they
  974. were whitespace in most modes.
  975.  
  976.    `C-M-f' or `C-M-b' with an argument repeats that operation the
  977. specified number of times; with a negative argument, it moves in the
  978. opposite direction.
  979.  
  980.    Killing a sexp at a time can be done with `C-M-k' (`kill-sexp') or
  981. `C-M-DEL' (`backward-kill-sexp').  `C-M-k' kills the characters that
  982. `C-M-f' would move over, and `C-M-DEL' kills the characters that
  983. `C-M-b' would move over.
  984.  
  985.    The "list commands" move over lists like the sexp commands but skip
  986. blithely over any number of other kinds of sexps (symbols, strings,
  987. etc).  They are `C-M-n' (`forward-list') and `C-M-p' (`backward-list').
  988. The main reason they are useful is that they usually ignore comments
  989. (since the comments usually do not contain any lists).
  990.  
  991.    `C-M-n' and `C-M-p' stay at the same level in parentheses, when
  992. that's possible.  To move *up* one (or N) levels, use `C-M-u'
  993. (`backward-up-list').  `C-M-u' moves backward up past one unmatched
  994. opening delimiter.  A positive argument serves as a repeat count; a
  995. negative argument reverses direction of motion and also requests
  996. repetition, so it moves forward and up one or more levels.
  997.  
  998.    To move *down* in list structure, use `C-M-d' (`down-list').  In
  999. Lisp mode, where `(' is the only opening delimiter, this is nearly the
  1000. same as searching for a `('.  An argument specifies the number of levels
  1001. of parentheses to go down.
  1002.  
  1003.    A somewhat random-sounding command which is nevertheless handy is
  1004. `C-M-t' (`transpose-sexps'), which drags the previous sexp across the
  1005. next one.  An argument serves as a repeat count, and a negative
  1006. argument drags backwards (thus canceling out the effect of `C-M-t' with
  1007. a positive argument).  An argument of zero, rather than doing nothing,
  1008. transposes the sexps ending after point and the mark.
  1009.  
  1010.    To set the region around the next sexp in the buffer, use `C-M-@'
  1011. (`mark-sexp'), which sets mark at the same place that `C-M-f' would
  1012. move to.  `C-M-@' takes arguments like `C-M-f'.  In particular, a
  1013. negative argument is useful for putting the mark at the beginning of
  1014. the previous sexp.
  1015.  
  1016.    The list and sexp commands' understanding of syntax is completely
  1017. controlled by the syntax table.  Any character can, for example, be
  1018. declared to be an opening delimiter and act like an open parenthesis.
  1019. *Note Syntax::.
  1020.  
  1021. 
  1022. File: emacs,  Node: Defuns,  Next: Program Indent,  Prev: List Commands,  Up: Programs
  1023.  
  1024. Defuns
  1025. ======
  1026.  
  1027.    In Emacs, a parenthetical grouping at the top level in the buffer is
  1028. called a "defun".  The name derives from the fact that most top-level
  1029. lists in a Lisp file are instances of the special form `defun', but any
  1030. top-level parenthetical grouping counts as a defun in Emacs parlance
  1031. regardless of what its contents are, and regardless of the programming
  1032. language in use.  For example, in C, the body of a function definition
  1033. is a defun.
  1034.  
  1035. `C-M-a'
  1036.      Move to beginning of current or preceding defun
  1037.      (`beginning-of-defun').
  1038.  
  1039. `C-M-e'
  1040.      Move to end of current or following defun (`end-of-defun').
  1041.  
  1042. `C-M-h'
  1043.      Put region around whole current or following defun (`mark-defun').
  1044.  
  1045.    The commands to move to the beginning and end of the current defun
  1046. are `C-M-a' (`beginning-of-defun') and `C-M-e' (`end-of-defun').
  1047.  
  1048.    If you wish to operate on the current defun, use `C-M-h'
  1049. (`mark-defun') which puts point at the beginning and mark at the end of
  1050. the current or next defun.  For example, this is the easiest way to get
  1051. ready to move the defun to a different place in the text.  In C mode,
  1052. `C-M-h' runs the function `mark-c-function', which is almost the same
  1053. as `mark-defun'; the difference is that it backs up over the argument
  1054. declarations, function name and returned data type so that the entire C
  1055. function is inside the region.  *Note Marking Objects::.
  1056.  
  1057.    Emacs assumes that any open-parenthesis found in the leftmost column
  1058. is the start of a defun.  Therefore, *never put an open-parenthesis at
  1059. the left margin in a Lisp file unless it is the start of a top level
  1060. list.  Never put an open-brace or other opening delimiter at the
  1061. beginning of a line of C code unless it starts the body of a function.*
  1062. The most likely problem case is when you want an opening delimiter at
  1063. the start of a line inside a string.  To avoid trouble, put an escape
  1064. character (`\', in C and Emacs Lisp, `/' in some other Lisp dialects)
  1065. before the opening delimiter.  It will not affect the contents of the
  1066. string.
  1067.  
  1068.    In the remotest past, the original Emacs found defuns by moving
  1069. upward a level of parentheses until there were no more levels to go up.
  1070. This always required scanning all the way back to the beginning of the
  1071. buffer, even for a small function.  To speed up the operation, Emacs
  1072. was changed to assume that any `(' (or other character assigned the
  1073. syntactic class of opening-delimiter) at the left margin is the start
  1074. of a defun.  This heuristic is nearly always right and avoids the
  1075. costly scan; however, it mandates the convention described above.
  1076.  
  1077. 
  1078. File: emacs,  Node: Program Indent,  Next: Matching,  Prev: Defuns,  Up: Programs
  1079.  
  1080. Indentation for Programs
  1081. ========================
  1082.  
  1083.    The best way to keep a program properly indented is to use Emacs to
  1084. re-indent it as you change it.  Emacs has commands to indent properly
  1085. either a single line, a specified number of lines, or all of the lines
  1086. inside a single parenthetical grouping.
  1087.  
  1088. * Menu:
  1089.  
  1090. * Basic Indent::    Indenting a single line.
  1091. * Multi-line Indent::   Commands to reindent many lines at once.
  1092. * Lisp Indent::        Specifying how each Lisp function should be indented.
  1093. * C Indent::        Extra features for indenting C code.
  1094. * Custom C Indent::    Controlling indentation style for C code.
  1095.  
  1096.    Emacs also provides a Lisp pretty-printer in the library `pp'.  This
  1097. program prints a Lisp object with indentation chosen to look nice.
  1098.  
  1099. 
  1100. File: emacs,  Node: Basic Indent,  Next: Multi-line Indent,  Up: Program Indent
  1101.  
  1102. Basic Program Indentation Commands
  1103. ----------------------------------
  1104.  
  1105. `TAB'
  1106.      Adjust indentation of current line.
  1107.  
  1108. `LFD'
  1109.      Equivalent to RET followed by TAB (`newline-and-indent').
  1110.  
  1111.    The basic indentation command is TAB, which gives the current line
  1112. the correct indentation as determined from the previous lines.  The
  1113. function that TAB runs depends on the major mode; it is
  1114. `lisp-indent-line' in Lisp mode, `c-indent-line' in C mode, etc.  These
  1115. functions understand different syntaxes for different languages, but
  1116. they all do about the same thing.  TAB in any programming language
  1117. major mode inserts or deletes whitespace at the beginning of the
  1118. current line, independent of where point is in the line.  If point is
  1119. inside the whitespace at the beginning of the line, TAB leaves it at
  1120. the end of that whitespace; otherwise, TAB leaves point fixed with
  1121. respect to the characters around it.
  1122.  
  1123.    Use `C-q TAB' to insert a tab at point.
  1124.  
  1125.    When entering lines of new code, use LFD (`newline-and-indent'),
  1126. which is equivalent to a RET followed by a TAB.  LFD creates a blank
  1127. line, and then gives it the appropriate indentation.
  1128.  
  1129.    TAB indents the second and following lines of the body of a
  1130. parenthetical grouping each under the preceding one; therefore, if you
  1131. alter one line's indentation to be nonstandard, the lines below will
  1132. tend to follow it.  This behavior is convenient in cases where you have
  1133. overridden the standard result of TAB because you find it unaesthetic
  1134. for a particular line.
  1135.  
  1136.    Remember that an open-parenthesis, open-brace or other opening
  1137. delimiter at the left margin is assumed by Emacs (including the
  1138. indentation routines) to be the start of a function.  Therefore, you
  1139. must never have an opening delimiter in column zero that is not the
  1140. beginning of a function, not even inside a string.  This restriction is
  1141. vital for making the indentation commands fast; you must simply accept
  1142. it.  *Note Defuns::, for more information on this.
  1143.  
  1144.